/**************************************************************************************************
* Title: SumFileLoading.h
* Author: Gael Huber
* Description: Defines several utility functions for generic file loading.
**************************************************************************************************/
#include "SumFileLoading.h"

/**************************************************************************************************
* Calculates the filesize in bytes of a file
**************************************************************************************************/
void GetFileSize(ifstream& file, long& size) {
	file.seekg(0, ios::end);
	size = (long)file.tellg();
	file.seekg(0, ios::beg);
}

// Read the file and store the information in the array provided
void ReadFile(ifstream& file, unsigned char* data, long size) {
	file.read((char*) data, size);
}

/**************************************************************************************************
* Read a line from a file
**************************************************************************************************/
void ReadLine(fstream& stream, char* cLine, String& sLine, streamsize count) {
	stream.getline(cLine, count);
	sLine.set(cLine);
}
